package gui;

import manager.universe.Universe;

import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;

public class MListener implements MouseListener {

	private double oldX=0 , oldY=0;
	
	@Override
	public void mouseClicked(MouseEvent m) {
		oldX= m.getX();
		oldY= m.getY();
		
	}

	@Override
	public void mouseDragged(MouseEvent m) {
		Universe u = Universe.getUniverse();
		u.getCamera().setIncremRotX(0.01*(m.getX()-oldX));
		u.getCamera().setIncremRotY(0.01*(m.getY()-oldY));
		oldX= m.getX();
		oldY= m.getY();
		Universe.release();

	}

	@Override
	public void mouseEntered(MouseEvent m) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent m) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent m) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent m) {
		oldX=m.getX();
		oldY=m.getY();
	}

	@Override
	public void mouseReleased(MouseEvent m) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseWheelMoved(MouseEvent m) {
		// TODO Auto-generated method stub
		
	}

}
